package zzti.com.Utils;

import android.app.ActivityManager;
import android.content.Context;

import java.util.List;

/**
 * Created by ASUS-PC on 2016/4/16.
 */
public class Util {
    public static boolean isserviceAlive(Context context, String servicename) {
        ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        List<ActivityManager.RunningServiceInfo> runlist = manager.getRunningServices(30);
        for (int i = 0; i < runlist.size(); i++) {
            if (servicename.equals(runlist.get(i).service.getClassName())) {
                return false;
            }
        }
        return true;
    }
}
